/*
 *
 * (C) COPYRIGHT 2017-2020 ARM Limited. All rights reserved.
 *
 * This program is free software and is provided to you under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation, and any use by you of this program is subject to the terms
 * of such GNU licence.
 *
 * A copy of the licence is included with the program, and can also be obtained
 * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

/* Kernel-side tests may include mali_kbase's headers. Therefore any config
 * options which affect the sizes of any structs (e.g. adding extra members)
 * must be included in these defaults, so that the structs are consistent in
 * both mali_kbase and the test modules. */
bob_defaults {
    name: "mali_kbase_shared_config_defaults",
    no_mali: {
        kbuild_options: ["CONFIG_MALI_NO_MALI=y"],
    },
    mali_real_hw: {
        kbuild_options: ["CONFIG_MALI_REAL_HW=y"],
    },
    mali_devfreq: {
        kbuild_options: ["CONFIG_MALI_DEVFREQ=y"],
    },
    mali_midgard_dvfs: {
        kbuild_options: ["CONFIG_MALI_MIDGARD_DVFS=y"],
    },
    mali_debug: {
        kbuild_options: ["CONFIG_MALI_DEBUG=y"],
    },
    buslog: {
        kbuild_options: ["CONFIG_MALI_BUSLOG=y"],
    },
    cinstr_vector_dump: {
        kbuild_options: ["CONFIG_MALI_VECTOR_DUMP=y"],
    },
    cinstr_gwt: {
        kbuild_options: ["CONFIG_MALI_CINSTR_GWT=y"],
    },
    mali_gator_support: {
        kbuild_options: ["CONFIG_MALI_GATOR_SUPPORT=y"],
    },
    mali_midgard_enable_trace: {
        kbuild_options: ["CONFIG_MALI_MIDGARD_ENABLE_TRACE=y"],
    },
    mali_system_trace: {
        kbuild_options: ["CONFIG_MALI_SYSTEM_TRACE=y"],
    },
    mali_pwrsoft_765: {
        kbuild_options: ["CONFIG_MALI_PWRSOFT_765=y"],
    },
    mali_memory_fully_backed: {
        kbuild_options: ["CONFIG_MALI_MEMORY_FULLY_BACKED=y"],
    },
    mali_dma_buf_map_on_demand: {
        kbuild_options: ["CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND=y"],
    },
    mali_dma_buf_legacy_compat: {
        kbuild_options: ["CONFIG_MALI_DMA_BUF_LEGACY_COMPAT=y"],
    },
    mali_arbiter_support: {
        kbuild_options: ["CONFIG_MALI_ARBITER_SUPPORT=y"],
    },
    mali_gem5_build: {
       kbuild_options: ["CONFIG_MALI_GEM5_BUILD=y"],
    },
    kbuild_options: [
        "MALI_UNIT_TEST={{.unit_test_code}}",
        "MALI_CUSTOMER_RELEASE={{.release}}",
        "MALI_USE_CSF={{.gpu_has_csf}}",
        "MALI_KERNEL_TEST_API={{.debug}}",
    ],
    defaults: ["kernel_defaults"],
}

bob_kernel_module {
    name: "mali_kbase",
    srcs: [
        "*.c",
        "*.h",
        "Kbuild",
        "backend/gpu/*.c",
        "backend/gpu/*.h",
        "backend/gpu/Kbuild",
        "context/*.c",
        "context/*.h",
        "ipa/*.c",
        "ipa/*.h",
        "ipa/Kbuild",
        "platform/*.h",
        "platform/*/*.c",
        "platform/*/*.h",
        "platform/*/Kbuild",
        "thirdparty/*.c",
        "debug/*.c",
        "debug/*.h",
        "device/*.c",
        "device/*.h",
        "gpu/*.c",
        "gpu/*.h",
        "tl/*.c",
        "tl/*.h",
        "mmu/*.c",
        "mmu/*.h",
    ],
    kbuild_options: [
        "CONFIG_MALI_KUTF=n",
        "CONFIG_MALI_MIDGARD=m",
        "CONFIG_MALI_NO_MALI_DEFAULT_GPU={{.gpu}}",
        "CONFIG_MALI_PLATFORM_NAME={{.mali_platform_name}}",
    ],
    buslog: {
        extra_symbols: [
            "bus_logger",
        ],
    },
    mali_corestack: {
        kbuild_options: ["CONFIG_MALI_CORESTACK=y"],
    },
    mali_error_inject: {
        kbuild_options: ["CONFIG_MALI_ERROR_INJECT=y"],
    },
    mali_error_inject_random: {
        kbuild_options: ["CONFIG_MALI_ERROR_INJECT_RANDOM=y"],
    },
    cinstr_secondary_hwc: {
        kbuild_options: ["CONFIG_MALI_PRFCNT_SET_SECONDARY=y"],
    },
    cinstr_secondary_hwc_via_debug_fs: {
        kbuild_options: ["CONFIG_MALI_PRFCNT_SET_SECONDARY_VIA_DEBUG_FS=y"],
    },
    mali_2mb_alloc: {
        kbuild_options: ["CONFIG_MALI_2MB_ALLOC=y"],
    },
    mali_hw_errata_1485982_not_affected: {
        kbuild_options: ["CONFIG_MALI_HW_ERRATA_1485982_NOT_AFFECTED=y"],
    },
    mali_hw_errata_1485982_use_clock_alternative: {
        kbuild_options: ["CONFIG_MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE=y"],
    },
    gpu_has_job_manager: {
        srcs: [
            "context/backend/*_jm.c",
            "debug/backend/*_jm.c",
            "debug/backend/*_jm.h",
            "device/backend/*_jm.c",
            "gpu/backend/*_jm.c",
            "gpu/backend/*_jm.h",
            "jm/*.h",
            "tl/backend/*_jm.c",
            "mmu/backend/*_jm.c",
        ],
    },
    gpu_has_csf: {
        srcs: [
            "context/backend/*_csf.c",
            "csf/*.c",
            "csf/*.h",
            "csf/Kbuild",
            "debug/backend/*_csf.c",
            "debug/backend/*_csf.h",
            "device/backend/*_csf.c",
            "gpu/backend/*_csf.c",
            "gpu/backend/*_csf.h",
            "tl/backend/*_csf.c",
            "mmu/backend/*_csf.c",
        ],
    },
    mali_arbiter_support: {
        srcs: [
            "arbiter/*.c",
            "arbiter/*.h",
            "arbiter/Kbuild",
        ],
    },
    defaults: ["mali_kbase_shared_config_defaults"],
}
